home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 4 / Amiga Tools 4.iso / tools / mail-tools / thor / thor_2.22 / thor.lha / rexx / AddUser.thor next >
Text File  |  1995-12-18  |  2KB  |  74 lines

  1. /* $VER: AddUser.thor v1.2 (20.12.94)
  2.  *
  3.  * by Magne Østlyngen
  4.  *
  5.  * Adds the sender of the current message to the user database.
  6.  */
  7.  
  8. options results
  9.  
  10. p=address()||' '||show('P',,);if pos('THOR.',p)>0 then thorport=word(,
  11. substr(p,pos('THOR.',p)),1);else do;say 'No THOR port found!';exit 10;end
  12.  
  13. if ~show('p', 'BBSREAD') then do
  14.     address command
  15.         "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
  16.         "WaitForPort BBSREAD"
  17. end
  18.  
  19. address(thorport)
  20.  
  21.  
  22. CURRENTMSG STEM msg
  23. if rc~=0 then do
  24.     REQUESTNOTIFY '"CURRENTMSG failed: '||THOR.LASTERROR||'"' '"_Ok"'
  25.     exit
  26. end
  27.  
  28. address BBSREAD
  29. READBRMESSAGE '"'||msg.bbsname||'"' '"'||msg.confname||'"' msg.msgnr HEADSTEM head
  30. if rc~=0 then do
  31.     address(thorport)
  32.     REQUESTNOTIFY '"READBRMESSAGE failed: '||BBSREAD.LASTERROR||'"' '"_Ok"'
  33.     exit
  34. end
  35.  
  36. if head.fromaddr = 'HEAD.FROMADDR' then head.fromaddr = ""
  37.  
  38. address(thorport)
  39.  
  40. REQUESTSTRING 'TITLE="Enter Name:" BT="_Ok|_Cancel" ID="'||head.fromname||'" MAXCHARS=100'
  41. if rc = 0 then head.fromname = result
  42.  
  43. REQUESTSTRING 'TITLE="Enter Address:" BT="_Ok|_Cancel" ID="'||head.fromaddr||'" MAXCHARS=100'
  44. if rc = 0 then head.fromaddr = result
  45.  
  46. wbu.comment.1 = ""
  47. REQUESTSTRING 'TITLE="Enter Comment:" BT="_Ok|_Cancel" MAXCHARS=100'
  48. if rc = 0 then wbu.comment.1 = result
  49.  
  50. wbu.alias = ""
  51. REQUESTSTRING 'TITLE="Enter Alias:" BT="_Ok|_Cancel" MAXCHARS=100'
  52. if rc = 0 then wbu.alias = result
  53.  
  54. REQUESTNOTIFY '"Name : '||head.fromname||'\nAddr : '||head.fromaddr||'\nComnt: '||wbu.comment.1||'\nAlias: '||wbu.alias||'\n\nAdd this user?"' '"_Yes|_No"'
  55. if rc~=0 then do
  56.     REQUESTNOTIFY '"REQUESTNOTIFY failed: '||THOR.LASTERROR||'"' '"_Ok"'
  57.     exit
  58. end
  59. if result~=0 then do
  60.     wbu.name = head.fromname
  61.     wbu.address = head.fromaddr
  62.     if wbu.comment.1 = "" then wbu.comment.count = 0; else wbu.comment.count = 1
  63.  
  64.     address BBSREAD
  65.     WRITEBRUSER '"'||msg.bbsname||'"' STEM wbu ONLYIFEXIST
  66.     if rc~=0 then do
  67.         address(thorport)
  68.         REQUESTNOTIFY '"WRITEBRUSER failed: '||BBSREAD.LASTERROR||'"' '"_Ok"'
  69.         exit
  70.     end
  71. end
  72.  
  73. exit
  74.